﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;

namespace ReactXML.Logic
{
    class ReactXMLFile
    {
        public static string szPublishPath = "./Publish/";
        string szFileName = string.Empty;
        List<PicNode> NodeList = new List<PicNode>();

        public void SaveCSDXML ()
        {
            string szFile = string.Format("{0}{1}.cs{2}", szPublishPath, szFileName, "d");
            string szData = string.Empty;

            foreach (PicNode node in NodeList)
            {
                szData += node.ToCSDXML();
            }

            XmlFileHelper.GetInstance().SaveDocument(szFile, szData);
        }

        public void LoadFromCSDXML (string szFilePath)
        {
            Log.Assert(szFilePath != string.Empty && szFilePath != null, Log.TraceLogLevel.Error, "ReactXMLFile LoadFromCSDXML Fail, szFilePath is Empty");

            XmlDocument doc = XmlFileHelper.GetInstance().GetDocument(szFilePath);

            // Create Pic Node ...
            Log.WriteTraceLog(Log.TraceLogLevel.Debug, doc.InnerText);
        }
    }
}
